/**
 * 
 */
package fr.univ_tln.inf9.exaplanning.controleur.salle;

import java.util.List;


import fr.univ_tln.inf9.exaplanning.api.salle.Material;
import fr.univ_tln.inf9.exaplanning.api.salle.Room;
import fr.univ_tln.inf9.exaplanning.gui.salle.JFrameListMaterial;

/**
 * @author pivi
 *
 */
public class RoomController {

	/**
	 * Ici les déclarations des frames de la gui
	 */
	public RoomView listView = null;
	
	private Room r = null;
	
	public RoomController (Room r){
		this.r = r;
		
		listView = new JFrameListMaterial(this, r.getEquipment(),r.getId());
		
		addToListMaterialListener();
		
		}


	private void addToListMaterialListener() {
		r.addListMaterialListener(listView);
		
	}

	

	public void displayViews(){
		listView.display();
	}
	
	public void closeViews(){
		listView.close();
	}
	
	public void notifyListEquipmentChanged(List<String> mat){
		r.setEquipment(mat);;
	}
	
	public void notifyElementAddedToList(Material m){
		r.add(m);
	}
	
	
	public void notifyElementRemovedToList(String nameM){
		r.remove(nameM);
	}

}
